package org.huzhp.console.config;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.huzhp.console.entity.vo.GatewayRouteVo;
import org.huzhp.console.service.IConsoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 * @Description: java类作用描述
 * @Author: huzp
 * @CreateDate: 2020/3/12 18:01
 * @Version: 1.0
 */

@Component
public class ConsoleCommandLineRunner implements CommandLineRunner {


    private static final String EUREKA_API = "/eureka/apps";

    @Autowired
    private IConsoleService consoleService;

    @Autowired
    private RestTemplate restTemplate;

    @Override
    public void run(String... args) throws Exception {

        GatewayRouteVo routeVo = new GatewayRouteVo();
//        String apps = restTemplate.getForObject(eurekaServer+EUREKA_API,String.class);
        ObjectMapper mapper = new ObjectMapper();
//        Map<String,Object> services = mapper.readValue(apps, Map.class);
//        consoleService.saveRoute(routeVo);
    }
}
